import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'index.dart';

class MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        statusBarBrightness: Brightness.light
    ));
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      // appBar: AppBar(
      //   // Here we take the value from the MyHomePage object that was created by
      //   // the App.build method, and use it to set our appbar title.
      //   title: Text(widget.title),
      // ),
      body: Container(
        color: const Color(0xff808080),
        child: Center(
          // Center is a layout widget. It takes a single child and positions it
          // in the middle of the parent.
            child: Container(
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(10),
              ),
              width: double.infinity,
              margin: const EdgeInsets.only(left: 27, right: 27),
              padding:
              const EdgeInsets.only(top: 30, bottom: 20, left: 20, right: 20),
              child: Column(
                // Column is also a layout widget. It takes a list of children and
                // arranges them vertically. By default, it sizes itself to fit its
                // children horizontally, and tries to be as tall as its parent.
                //
                // Invoke "debug painting" (press "p" in the console, choose the
                // "Toggle Debug Paint" action from the Flutter Inspector in Android
                // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
                // to see the wireframe for each widget.
                //
                // Column has various properties to control how it sizes itself and
                // how it positions its children. Here we use mainAxisAlignment to
                // center the children vertically; the main axis here is the vertical
                // axis because Columns are vertical (the cross axis would be
                // horizontal).
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  const Text(
                    '服务协议和隐私政策提示',
                    style: TextStyle(
                        color: Color(0xff212732),
                        fontSize: 20,
                        fontWeight: FontWeight.bold),
                  ),
                  const Padding(padding: EdgeInsets.only(top: 30)),
                  Stack(
                    children: [
                      Container(
                        height: 320,
                        child: SingleChildScrollView(
                          child: RichText(
                              text: TextSpan(
                                  text:
                                  '感谢您使用个人图书馆！为了更好的保障您的个人权益，在您使用个人图书馆前，请务必审慎阅读',
                                  style: const TextStyle(
                                      color: Color(0xff8c8c8c), fontSize: 14),
                                  children: [
                                    TextSpan(
                                        text: '《隐私政策》',
                                        style:
                                        const TextStyle(color: Color(0xff5a6f9b)),
                                        recognizer: TapGestureRecognizer()
                                          ..onTap = () {}),
                                    const TextSpan(
                                        text: '及',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                    TextSpan(
                                        text: '《服务条款》',
                                        style:
                                        const TextStyle(color: Color(0xff5a6f9b)),
                                        recognizer: TapGestureRecognizer()
                                          ..onTap = () {}),
                                    const TextSpan(
                                        text:
                                        '，以帮助您了解个人图书馆对您个人信息的收集/保存/使用/共享披露/保护等情况，以及您享有的相关权利。\n\n',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                    const TextSpan(
                                        text:
                                        '1.为向您提供账号注册/登录服务，个人图书馆将收集您主动提供的身份信息，包括：手机号码、验证码、邮箱信息、密码、第三方登录的个人信息等用于账号注册/登录的信息。\n\n',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                    const TextSpan(style: TextStyle(height: 20)),
                                    const TextSpan(
                                        text:
                                        '2.为向您提供信息的发布、保存、离线阅读、交流互动功能，个人图书馆可能会申请您的相机、相册、麦克风权限。\n\n',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                    const TextSpan(style: TextStyle(height: 20)),
                                    const TextSpan(
                                        text:
                                        '3.个人图书馆仅会根据您使用具体功能的需要，收集需要的用户信息、系统权限（包括相机、相册、麦克风、设备信息等）且仅在您授权同意后，在您授权的范围内进行访问。\n\n',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                    const TextSpan(style: TextStyle(height: 20)),
                                    const TextSpan(
                                        text:
                                        '4.您可以在使用个人图书馆过程中访问、更正、删除您的个人信息并管理您的授权。如您对以上内容有任何疑问，可拨打4000999276与个人图书馆联系。如您同意以上的内容，请点击“同意并继续”，开始使用个人图书馆的产品和服务！\n\n',
                                        style: TextStyle(
                                            color: Color(0xff8c8c8c), fontSize: 14)),
                                  ])),
                        ),
                      ),
                      Positioned(
                          bottom: 0,
                          left: 0,
                          right: 0,
                          child: IgnorePointer(
                            child: Container(
                              height: 40,
                              width: double.infinity,
                              decoration: const BoxDecoration(
                                  gradient: LinearGradient(
                                      begin: Alignment.topCenter,
                                      end: Alignment.bottomCenter,
                                      colors: [
                                        Color(0x00ffffff),
                                        Color(0xffffffff)
                                      ])),
                            ),
                          ))
                    ],
                  ),
                  Container(
                    width: double.infinity,
                    height: 45,
                    margin: const EdgeInsets.only(top: 10),
                    child: ElevatedButton(
                      onPressed: () {},
                      style: ElevatedButton.styleFrom(
                          backgroundColor: const Color(0xff29cf74)),
                      child: const Text(
                        '同意并继续',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 18,
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                  ),
                  TextButton(
                      onPressed: () {},
                      child: const Text(
                        '不同意',
                        style: TextStyle(color: Color(0xffabafb6), fontSize: 16),
                      ))
                ],
              ),
            )),
      ),
    );
  }
}